UserController = function ($scope, Service, Resources) {

	$scope.user = $scope.user
    || {
      'addUser' : function() {
    	  Resources.addUser({
          	name : $scope.name,
          	lastName : $scope.lastName,
  		}, function(data) {
  			$scope.user.showUserAdded = true;
  			$scope.user.tituloAddUser = "EL USUARIO FUE AGRAGADO!";
  			$scope.user.nameAdded = $scope.name;
  			$scope.user.lastNameAdded = $scope.lastName;
  		}, function(data) {
  			$scope.user.showUserConfirmed = false;
  		});
        },
        
        'listUser' : function() {
      	  Resources.listUser({
    		}, function(data) {
    			$scope.user.tituloListUser = "LISTA DE USUARIOS AGREGADOS!";
    			$scope.user.list = data;
    			$scope.user.showUserList = true;
    		}, function(data) {
    			$scope.user.showUserList = false;
    		});
          },
          
          'deleteUser' : function(lastNameToDelete, nameToDelete) {
        	  Resources.deleteUser({
        		name : nameToDelete,
                lastName : lastNameToDelete,
      		}, function(data) {
      			$scope.user.pepe = "";
      		}, function(data) {
      			$scope.user.pepe = "";
      		});
          },
          
          'addAtributeToBody' : function() {
        	  var a = document.createAttribute("class");
        	  a.nodeValue = "span13";
        	  document.body.setAttributeNode(a);
        	  var b = document.createAttribute("style");
        	  b.nodeValue = "background-color: #E0FFFF";
        	  document.body.setAttributeNode(b);
          }
          
    };
    
    $scope.user.addAtributeToBody();
};
